#ifndef MAINW_H
#define MAINW_H
#include <QSqlDatabase>
#include <QMainWindow>
#include<QTableWidgetItem>
#include <QSqlQueryModel>
#include <QSqlQuery>
#include<QStringList>
#include"my_sdk.h"
#include<QProgressDialog>
#include<QDateTime>
#include<QPaintEvent>
#include <QPixmap>
#include"dialog.h"
#include "mydata.h"
 #include "onlinethread.h"
namespace Ui {
    class MainW;
}

class MainW : public QMainWindow {
    Q_OBJECT
public:
    MainW(QWidget *parent = 0);
    ~MainW();
    void paintEvent(QPaintEvent *);
protected:
    void changeEvent(QEvent *e);
    void setStyle();
    void  MyMessage(int &on,int &off,QString str1,QString str2);
    void  GetCheckState();
    void OutPutStyle(QString str1);
    void insert(Mydata &mydata);
    void update(Mydata &mydata);
    void setStyle2();
private:
    Ui::MainW *ui;
    QSqlDatabase db ;
    QSqlQuery query;
    QString ip,id,build,unit,room,admin,upId,autoId;
    QString device;
    QString str,condition;

    QString save,where;
    QList<int> checkRow;
    QList<QLineEdit*> listEdit;
    My_SDK  *sdk;
    QProgressDialog *process;
    QDateTime time ;
    QTimer *timer;
    Dialog *dialog;
    OnlineThread *onlineThread;
    bool cse;
private slots:
   // void on_pushButton_6_clicked();
    void on_tableWidget_activated(QModelIndex index);
    void on_pushButton_7_clicked();
    void on_checkBox_clicked();
    void on_pushButton_6_clicked();
    void on_checkBox_clicked(bool checked);
    void on_pushButton_5_clicked();
    void on_tableWidget_clicked(QModelIndex index);
    void on_pushButton_4_clicked();
    void on_pushButton_3_clicked();
    void on_pushButton_2_clicked();
    void on_pushButton_clicked();
    void autoUpdate();
    void reciveMyData(Mydata &mydata);
    void  reciveOnline(bool cse);
};

#endif // MAINW_H
